package cn.sany.cterminal.common.enumeration;

/**
 * 自动驾驶状态
 1：正常道路行走
 2：正常泊车行走
 3；正常停车
 4：遇障停车
 5：遇障行车
 6：故障停车
 7：等待装料
 8：装料执行中
 9：等待卸料
 10：卸料执行中
 11：等待任务
 12：等待入场
 13：异常

 */
public enum AutoStateEnum {
    ROAD_WALK(1, "正常道路行走"),
    PARK_WALK(2, "正常泊车行走"),
    KEY_OFF(3, "正常停车"),
    LOST_POWER(4, "遇障停车"),
    FAULT_PARK(5, "遇障行车"),
    FAULT_STOP(6, "故障停车"),
    WAIT_LOAD(7, "等待装料"),
    LOAD_ING(8, "装料执行中"),
    WAIT_UNLOAD(9, "等待卸料"),
    UNLOAD_ING(10, "卸料执行中"),
    WAIT_TASK(11, "等待任务"),
    WAIT_MARCH_IN(12, "等待入场"),
    EXCEPTION(13, "异常");

    /**
     * 状态编码
     **/
    private int code;

    /**
     * 状态信息
     **/
    private String msg;


    AutoStateEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
    public static String getMsgByCode(int code){
        for(AutoStateEnum responseEnum : AutoStateEnum.values()) {
            if(responseEnum.getCode() == code){
                return responseEnum.msg;
            }
        }
        return null;
    }
}
